package com.base.cn.platform.os.controller.planTools;

import com.base.cn.platform.os.common.controller.BaseController;
import com.base.cn.platform.os.entity.planTools.PopupSloganDetail;
import com.base.cn.platform.os.service.planTools.PopupSloganDetailBiz;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.math.BigDecimal;
import java.util.List;


/**
 * 弹窗广告记录
 *
 * @Author: lxr
 * @Date: 2020/06/30 14:43
 */
@RestController
@RequestMapping("/manage")
public class PopupSloganDetailController extends BaseController {

    @Autowired
    private PopupSloganDetailBiz popupSloganDetailBiz;

    @RequestMapping("/finBySql")
    public List<PopupSloganDetail> finBySql(@RequestParam("whereSql") String whereSql) {
        return popupSloganDetailBiz.find(whereSql, null,null);
    }

    @RequestMapping("/savePopupSloganDetail")
    public BigDecimal savePopupSloganDetail(@RequestBody PopupSloganDetail popupSloganDetail) {
        popupSloganDetailBiz.save(popupSloganDetail);
        return popupSloganDetail.getId();
    }

    @RequestMapping("/updateClick")
    public void updateClick(@RequestParam("id") BigDecimal id) {
        PopupSloganDetail popupSloganDetail = new PopupSloganDetail();
        popupSloganDetail.setId(id);
        popupSloganDetail.setClick(1);
        popupSloganDetailBiz.updateById(popupSloganDetail, null);
    }
}
